package com.hsgene.consumables.service.impl;

import com.hsgene.common.util.result.ApiResult;
import com.hsgene.consumables.domain.v1.GeneticGoods;
import com.hsgene.consumables.domain.v1.GeneticGoodsApplyHistory;
import com.hsgene.consumables.persistence.GoodsApplyHistoryRepository;
import com.hsgene.consumables.persistence.GoodsRepository;
import com.hsgene.consumables.service.GoodsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wangbing
 * @version 1.0, 2018/9/21
 */
@Service
public class GoodsServiceImpl implements GoodsService {

    @Resource
    private GoodsRepository goodsRepository;

    @Resource
    private GoodsApplyHistoryRepository goodsApplyHistoryRepository;

    @Override
    public ApiResult<List<GeneticGoods>> queryGeneticGoods(String ids) {
        return ApiResult.succ(goodsRepository.queryByIds(ids));
    }

    @Override
    public ApiResult<List<GeneticGoodsApplyHistory>> queryServantGoods(String groundServantId) {

        return ApiResult.succ(goodsApplyHistoryRepository.queryServantPerGoodsHistory(groundServantId));
    }
}
